package com.wry.cloud.conf;

import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * <h1> GateWay配置类 <h1>
 *
 * @author 魏如元
 * @since 2022/9/9
 */
@Configuration
public class GateWayConfig {

    @Bean
    public RouteLocator customRouteLocator(RouteLocatorBuilder routeLocatorBuilder){
        final RouteLocatorBuilder.Builder routes = routeLocatorBuilder.routes();
        routes.route("path_route_frx01",
                r -> r.path("/payment/**")
                        .uri("lb://cloud-provider-payment")).build();
        return routes.build();
    }
}
